//
//  NKCaseSaveCell.m
//  NewKY
//
//  Created by MXQ on 2016/11/15.
//  Copyright © 2016年 Dee. All rights reserved.
//

#import "NKCaseSaveCell.h"
#import "UILabel+CZAddition.h"

@interface NKCaseSaveCell ()

@end
@implementation NKCaseSaveCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self setupSaveCaseCell];
        
    
        //cell背景颜色
        self.backgroundColor = [UIColor colorWithHexString:@"efeff4"];
    }

    return self;
}

#pragma mark - cell setUP
- (void)setupSaveCaseCell{

    //时间轴
    
    UIImageView * timeLine = [[UIImageView alloc]init];
    
    [timeLine setImage:[UIImage imageNamed:@"yj"]];
    
    [self.contentView addSubview:timeLine];
    
    [timeLine mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(13);
        make.width.equalTo(@2);
        make.bottom.equalTo(self.contentView);
    }];
    
    //时间点
    
    UIImageView* timePoint = [[UIImageView alloc]init];
    
    [timePoint setImage:[UIImage imageNamed:@"point"]];
    
    [self.contentView addSubview:timePoint];
    
    [timePoint mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView).offset(8);
        make.centerX.equalTo(timeLine);
        make.width.height.equalTo(@15);
        
        
    }];
    
    
    // 时间标签
    UILabel * timelable = [UILabel cz_labelWithText:@"2016-11-16 10:11:24" fontSize:14 color:
                           [UIColor grayColor]];
    
    [self.contentView addSubview:timelable];
    
    [timelable mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(timeLine.mas_right).offset(16);
        make.top.equalTo(self.contentView).offset(8);
        
    }];
    
    self.timeLable = timelable;
    
    
    //白色的View
    UIView* whiteView =[[UIView alloc]init];
    
    whiteView.backgroundColor = [UIColor whiteColor];
    
    [self.contentView addSubview:whiteView];
    
    [whiteView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(timelable.mas_bottom).offset(13)
        ;
        make.left.equalTo(timeLine.mas_right).offset(16);
        
        make.right.bottom.equalTo(self.contentView).offset(-16);
        
        
    }];
    
    
    
    //头像
    UIImageView * imgV = [[UIImageView alloc]init];

    [whiteView addSubview:imgV];
    
    self.illImageView = imgV;
    
    [imgV mas_makeConstraints:^(MASConstraintMaker *make) {

        
        
        make.top.equalTo(whiteView).offset(8);
        make.left.equalTo(whiteView).offset(8);
        
        make.bottom.equalTo(whiteView).offset(-8);
//        make.width.equalTo(whiteView.mas_height).multipliedBy(0.8);
        make.width.equalTo(@90);
    }];
    
    [imgV setImage:[UIImage imageNamed:@"patient_defaultphoto_male"]];

    
    //病名字

    UILabel * illNameLable = [UILabel cz_labelWithText:@"冠心病" fontSize:14 color:[UIColor blackColor]];
    
    [whiteView addSubview:illNameLable];
    self.illNameLable = illNameLable;
    
    [illNameLable mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(imgV.mas_right).offset(8);
        make.top.equalTo(imgV).offset(8);
    }];
    
    //
    UILabel * illDiscred = [UILabel cz_labelWithText:@"每天早上起来浑身麻木，不能上厕所，吃不下饭，走路都不想走，只想在上去睡一觉"
                                            fontSize:13 color:[UIColor lightGrayColor]];
    
    [whiteView addSubview:illDiscred];
    
    self.illDisCreb = illDiscred;
    illDiscred.numberOfLines = 3;
    
    [illDiscred mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(imgV.mas_right).offset(8);
        make.top.equalTo(illNameLable.mas_bottom).offset(8);
        make.right.equalTo(whiteView.mas_right).offset(-8);
    }];
    
    
    
    
    
    
    
    
    
}






- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
